package com.medisched.medisched.controller;

import com.medisched.medisched.domain.Schedule;
import com.medisched.medisched.service.IScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 排班Controller
 * 
 * @author ruoyi
 * @date 2025-05-15
 */
@CrossOrigin
@RestController
@RequestMapping("/system/schedule")
public class ScheduleController 
{
    @Autowired
    private IScheduleService scheduleService;

    /**
     * 查询排班列表
     */
    @GetMapping("/list")
    public List<Schedule> list(Schedule schedule)
    {
        List<Schedule> list = scheduleService.selectScheduleList(schedule);
        return (list);
    }


    /**
     * 获取排班详细信息
     */
    @GetMapping(value = "/{id}")
    public Schedule getInfo(@PathVariable("id") Long id)
    {
        return (scheduleService.selectScheduleById(id));
    }

    /**
     * 新增排班
     */
    @PostMapping
    public int add(@RequestBody Schedule schedule)
    {
        return (scheduleService.insertSchedule(schedule));
    }

    /**
     * 修改排班
     */
    @PutMapping
    public int edit(@RequestBody Schedule schedule)
    {
        return (scheduleService.updateSchedule(schedule));
    }

    /**
     * 删除排班
     */
	@DeleteMapping("/{ids}")
    public int remove(@PathVariable Long[] ids)
    {
        return (scheduleService.deleteScheduleByIds(ids));
    }
}
